/*
 * @Author: lqx 1096345766@qq.com
 * @Date: 2025-04-16 11:38:34
 * @LastEditors: lqx 1096345766@qq.com
 * @LastEditTime: 2025-04-16 13:55:35
 * @FilePath: \jxzr-lims-web\src\router\RouteGuard.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useSystemSettings, useUserInfo } from '@/store'
import React, { useEffect } from 'react'
import { useLocalStorageState } from 'ahooks'
import { StorageNameEnums } from '@/enums'
import { Navigate } from 'react-router'

interface Props {
  children: React.ReactNode
}

export default function RouteGuard({ children }: Props) {
  const [token] = useLocalStorageState(StorageNameEnums.Token)
  const getUserPermissionList = useUserInfo((state) => state.getUserPermissionList)

  useEffect(() => {
    init()
  }, [])

  async function init() {
    const permissionList = await getUserPermissionList()
  }

  // if (!token) {
  //   return <Navigate to="/login" />
  // }

  return children
}
